﻿using System;
using System.Collections.Generic;

using System.Text;
using Sinacor.Infra.UI.Common;

namespace Sinacor.UI.Bovespa.Operador.Communication.Translator.DataContractToModel
{
    public class Negocio 
    {
        public Model.Bolsa ToBolsa(Bovespa.Ordens.Negocio.BolsaResponse from)
        {
            Model.Bolsa to = null;

            if (from != null)
            {
                to = new Model.Bolsa();
                to.Codigo = from.Codigo;
                to.Descricao = from.Descricao;
            }
            
            return to;
        }

        public ModelCollection<Model.Bolsa> ToBolsa(List<Bovespa.Ordens.Negocio.BolsaResponse> from)
        {
            ModelCollection<Model.Bolsa> to = null;
            
            if (from != null)
            {
                to = new ModelCollection<Model.Bolsa>();
                
                foreach (Bovespa.Ordens.Negocio.BolsaResponse item in from)
                {
                    to.Add(this.ToBolsa(item));                    
                }
                
            }
            return to;
        }
    }
}
